package edu.njust.domain.user;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

//
@Data
public class User extends BaseUser implements Serializable {
    @JsonProperty("CM_ID")
    private int CM_ID;
    @JsonProperty("CM_PWD")
    private String CM_PWD;
    @JsonProperty("CM_NAME")
    private String CM_NAME;
    @JsonProperty("CM_PHONE")
    private String CM_PHONE;
    @JsonProperty("CM_IDNUMBER")
    private String CM_IDNUMBER;
    @JsonProperty("CM_AGE")
    private String CM_AGE;
    @JsonProperty("CM_ADDRESS")
    private String CM_ADDRESS;
    @JsonProperty("is_delete")
    //是否删除：0-未删除，1-已删除
    private int is_delete;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return is_delete == user.is_delete && CM_ID == user.CM_ID
                && Objects.equals(CM_PWD, user.CM_PWD)
                && Objects.equals(CM_NAME, user.CM_NAME)
                && Objects.equals(CM_PHONE, user.CM_PHONE) && Objects.equals(CM_IDNUMBER, user.CM_IDNUMBER)
                && Objects.equals(CM_AGE, user.CM_AGE) && Objects.equals(CM_ADDRESS, user.CM_ADDRESS);
    }

    @Override
    public int hashCode() {
        return Objects.hash(CM_ID, CM_PWD, CM_NAME, CM_PHONE, CM_IDNUMBER, CM_AGE, CM_ADDRESS, is_delete);
    }

    @Override
    public String toString() {
        return "User{" +
                "CM_ID=" + CM_ID +
                ", CM_PWD='" + CM_PWD + '\'' +
                ", CM_NAME='" + CM_NAME + '\'' +
                ", CM_PHONE='" + CM_PHONE + '\'' +
                ", CM_IDNUMBER='" + CM_IDNUMBER + '\'' +
                ", CM_AGE='" + CM_AGE + '\'' +
                ", CM_ADDRESS='" + CM_ADDRESS + '\'' +
                ", is_delete=" + is_delete +
                ", createdUser='" + createdUser + '\'' +
                ", createdTime=" + createdTime +
                ", modifiedUser='" + modifiedUser + '\'' +
                ", modifiedTime=" + modifiedTime +
                '}';
    }
}
